#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; ++i)
const int N = 1e5 + 10;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
ll a[N];
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    ll maxp = -INFLL;
    int n;
    cin >> n;
    rep(i, 0, n) cin >> a[i];
    sort(a, a + n);
    rep(i, 0, 5) {
      ll cur = 1;
      rep(j, 0, i) { cur *= a[j]; }
      rep(j, 0, 5 - i) { cur *= a[n - j - 1]; }
      maxp = max(cur, maxp);
    }
    cout << maxp << endl;
  }
}
